import 'dart:ffi';

import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBNavigator.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBFindModule/YBFindProvider/YBLocationInfoEventBus.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBFindModule/YBFindProvider/YBLocationInfoProvider.dart';
class YBSearchAdddressPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
       child: Scaffold(
         appBar: AppBar(
            elevation: 0,
            title: Text(YBChineseText.findSelectLocationTitle),
         ),
         body: ChangeNotifierProvider(
           create:(context) => YBLocationInfoProvider()..getLocationInfo(),
           child: Consumer<YBLocationInfoProvider>(builder:(context,locationlistInfo,child){
         //    print('-------${locationlistInfo.recodeStr}----');
             return ListView.builder(
               itemBuilder: (BuildContext context, int index){
                 Poi poiAddressList = locationlistInfo.addressList[index];
                 return Container(
                   color: YBColor.white,
                   child: InkWell(
                     child: Padding(
                       padding:EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                       child: Column(
                         mainAxisAlignment: MainAxisAlignment.center,
                         crossAxisAlignment: CrossAxisAlignment.stretch,
                         children: [
                           Container(
                             child: Text("${poiAddressList.title}",style: YBTextStyle.TextStyle18181814Medium,),
                           ),
                           Container(
                             child: Text("${poiAddressList.cityName}${poiAddressList.adName}${poiAddressList.address}",style: YBTextStyle.TextStyle7A7A7A12,),
                           ),
                         ],
                       ),
                     ),
                     onTap: () async {
                       locationInfoEventBus.fire(YBLocationInfoEventBus(cityTitle: poiAddressList.title));
                       YBNavigatorUtil.goDefaultBack(context);
                     },
                   ),
                 );
               },itemCount: locationlistInfo.addressList.length,itemExtent: YBTextStyle.adapterSize60,);
           }),
         ),
       ),
    );
  }
}
